﻿namespace ZFramework.Runtime
{
    public class ProtoPacketHandler : IPacketHandler
    {
        /// <summary>
        /// 获取网络消息包协议编号。
        /// </summary>
        public int Id
        {
            get { return PacketS2C.EventId; }
        }

        /// <summary>
        /// 网络消息包处理函数。
        /// </summary>
        /// <param name="sender">网络消息包源。</param>
        /// <param name="packet">网络消息包内容。</param>
        public void Handle(object sender, Packet packet)
        {
            PacketS2C packetS2C = packet as PacketS2C;
            if (packetS2C == null)
                return;

            var packetId = packetS2C.PacketId;
            var allMessages = packetS2C.AllMessages;
            foreach (var packetMessage in allMessages)
            {
                var reqId = packetMessage.ReqId;
                var xx = packetMessage.MsgName;
                var data = packetMessage.Data;
                Log.Error("收到小修");
            }
        }
    }
}